Skip to content

Add a build check against JVM and Android imports in commonMain - #3363

Closed
StylianosGakis wants to merge 1 commit into
developfrom
build/commonmain-import-guard
Closed

StylianosGakis wants to merge 1 commit into
developfrom
build/commonmain-import-guard

Conversation

@StylianosGakis

Copy link
Copy Markdown
Member
🤖 AI description

Adds ./gradlew checkCommonMainImports, which fails when a file under any src/commonMain imports java.*, javax.* or android.*, and runs it in the PR workflow.

A module with only JVM and Android targets compiles commonMain against the JDK, so JVM-only code can land there without anyone noticing until the module needs an iOS target. This check is the first step of making the whole app run on a second platform (desktop), where that mistake becomes easy to make.

develop has no violations today, so the allow-list in config/commonMain-import-allowlist.txt starts empty. The check is its own workflow step because the ktlint step is continue-on-error and could never fail the job.

…ommonMain

Fails with one <path>:<line>: <import> line per java.*, javax.* or
android.* import found under app/ and micro-apps/ src/commonMain,
skipping paths listed in config/commonMain-import-allowlist.txt.
Runs in the PR ktlint job as its own step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant